#include <bits/stdc++.h>
using namespace std;

int main() {
  freopen("censor.in", "r", stdin);
  freopen("censor.out", "w", stdout);
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  string s, t;

  cin >> s >> t;

  int pos = 0;
  while (1) {
    pos = s.find(t, pos);
    if (pos == -1) {
      break;
    }
    s.erase(pos, t.size());
    pos = max(pos - (int)t.size() + 1, 0);
  }
  cout << s;
  return 0;
}